package com.clarte.rights.service;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.clarte.common.dao.BaseDao;
import com.clarte.model.Rights;
@Service("rightsService")
@Transactional
public class RightsServiceImpl implements RightsService {
	@Resource(name="baseDao")
	private BaseDao<Rights, Integer> baseDao;
	@Override
	public void add(Rights rights) {
		baseDao.save(rights);
	}

	@Override
	public void del(Integer... id) {
		baseDao.delete(id);
	}

	@Override
	public void edit(Rights rights) {
		baseDao.update(rights);
	}

	@Override
	public List<Rights> findPri() {
		String hql = "select t from Rights t where t.parent is null";
		return baseDao.find(hql, null);
	}

}
